<template>
    <div>
        <div>
            活动信息:
            <input type="text" v-model="Info.ActionName">
            活动类型:
            <select  name="" id="" v-model="Info.ActionType">
                <option value="">请选择</option>
                <option :value="item.ActionType" v-for="item in data">{{ item.ActionType}}</option>
            </select>
            <input type="button" value="查询" @click="getlist" class="btn btn-primary">
        </div>
        <table class="table table-bordered">
            <tbody>
                <tr class="bg-primary">
                    <td>活动编号</td>
                    <td>活动信息</td>
                    <td>活动状态</td>
                    <td>活动类型</td>
                    <td>活动时间</td>
                    <td>活动地点</td>
                    <td>活动发起人</td>
                    <td>活动图片</td>
                    <td>操作</td>
                </tr>
                <tr v-for="item in data" :key="item.ActionId">
                    <td>{{ item.ActionId }}</td>
                    <td>{{ item.ActionName }}</td>
                    <td>{{ item.ActionState==1?'启用':'禁用' }}</td>
                    <td>{{ item.ActionType }}</td>
                    <td>{{ item.ActionTime }}</td>
                    <td>{{ item.ActionAddr }}</td>
                    <td>{{ item.ActionMan }}</td>
                    <td><img :src="item.ActionPhoto" alt="" width="60" height="80"></td>
                    <td>
                        <input type="button" value="修改" @click="update(item.ActionId)" class="btn btn-warning">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import { ref,reactive,onMounted } from 'vue';
import axios from 'axios';
import { useRoute,useRouter } from 'vue-router';

const router=useRouter();
const route=useRoute();

let data:any=ref([])
let Info:any=reactive({
    ActionName:'',
    ActionType:''
})
onMounted(()=>{
    getlist();
})
const getlist=()=>{
    axios({
        url:'/api/Action/GetActionsList',
        method:'get',
        params:Info
    })
    .then(res=>{
        console.log(res);
        data.value=res.data;
    })
    .catch(err=>{
        console.log(err);
        
    })
}
const update=(ActionId:any)=>{
    router.push({
        path:'/actionupdate',
        query:{
            ActionId:ActionId
        }
    })
}
</script>

<style scoped>

</style>